package a.f.n;

import a.a.kb;
import a.a.l;
import a.c.ab;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.m;
import a.c.v;
import a.c.z;
import a.f.ib;
import a.f.o;
import a.f.*;
import a.i.y;

import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import a.i.y;

public class jb
  implements vc
{
  public static final Object e = "y.layout.tree.TreeComponentLayouter.DUMMY_NODE_DPKEY";
  private rc f;
  private rc g;
  private boolean h;
  public static int i;
  
  public jb(rc paramrc)
  {
    this.g = paramrc;
  }
  
  public boolean canLayout(o paramo)
  {
    return (k.n) || ((this.f != null) && (this.g != null));
  }
  
  public void doLayout(o paramo)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    bb[] arrayOfbb = kb.b(paramo);
    if (!bool2)
    {
      if (arrayOfbb.length == 1)
      {
        if (bool2) {
          break label96;
        }
        if (arrayOfbb[0].size() == paramo.k())
        {
          if (!bool2)
          {
            if (l.k(paramo)) {
              this.g.doLayout(paramo);
            }
          }
          else {
            if (!bool1) {
              break label86;
            }
          }
          new ib(this.g).doLayout(paramo);
          label86:
          return;
        }
      }
      if (bool2) {
        break label111;
      }
    }
    if (l.i(paramo))
    {
      label96:
      this.g.doLayout(paramo);
      return;
    }
    label111:
    do
    {
      localObject1 = paramo.w();
      while (!bool1)
      {
        if (!((m)localObject1).e()) {
          break;
        }
        if (bool1) {
          break label156;
        }
        paramo.e(((m)localObject1).a());
        ((m)localObject1).f();
      }
    } while (bool2);
    label156:
    Object localObject1 = kb.b(paramo);
    Object localObject2 = paramo.w();
    do
    {
      do
      {
        if (!((m)localObject2).e()) {
          break;
        }
        paramo.e(((m)localObject2).a());
        ((m)localObject2).f();
        if ((!bool2) && (bool1)) {
          break label286;
        }
      } while (!bool1);
    } while (bool2);
    if ((bool2) || ((localObject1.length == 1) && ((bool2) || (localObject1[0].size() == paramo.k()))))
    {
      if (!bool2)
      {
        if (l.k(paramo)) {
          this.g.doLayout(paramo);
        }
      }
      else {
        if (!bool1) {
          break label285;
        }
      }
      new ib(this.g).doLayout(paramo);
      label285:
      return;
    }
    label286:
    localObject2 = new y(paramo);
    HashSet localHashSet = new HashSet();
    ab[] arrayOfab = kb.a(paramo, arrayOfbb);
    ArrayList localArrayList = new ArrayList();
    ((y)localObject2).b();
    int j = 0;
    Object localObject3;
    Object localObject4;
    Object localObject5;
    double d5;
    Object localObject12;
    label686:
    label688:
    label691:
    label874:
    label876:
    do
    {
      do
      {
        if (j >= arrayOfbb.length) {
          break label879;
        }
        localObject3 = arrayOfbb[j];
        localObject4 = arrayOfab[j];
        e locale = ((bb)localObject3).m();
        if (bool1) {
          break label901;
        }
        if (((bb)localObject3).size() <= 2) {
          break;
        }
        y.a(paramo, ((ab)localObject4).l());
        localObject5 = paramo.d();
        this.g.doLayout(paramo);
        double d2;
        double d1 = d2 = 1.7976931348623157E+308D;
        double d3 = d5 = -1.797693134862316E+308D;
        a.c.w localw4 = ((bb)localObject3).l();
        localw4.f();
        do
        {
          if (!localw4.e()) {
            break;
          }
          localObject10 = paramo.d(localw4.d());
          d1 = Math.min(d1, ((zc)localObject10).a());
          d2 = Math.min(d2, ((zc)localObject10).b());
          d3 = Math.max(d3, ((zc)localObject10).a() + ((zc)localObject10).c());
          d5 = Math.max(d5, ((zc)localObject10).b() + ((zc)localObject10).d());
          localw4.f();
          if (bool2) {
            break label876;
          }
          if (bool1) {
            break label874;
          }
        } while (!bool1);
        if (bool2) {
          break label913;
        }
        Object localObject10 = ((ab)localObject4).l();
        do
        {
          do
          {
            if (!((m)localObject10).e()) {
              break label691;
            }
            localObject11 = paramo.e(((m)localObject10).a());
            if (bool1) {
              break;
            }
            int i2 = 0;
            do
            {
              if (i2 >= ((zb)localObject11).a()) {
                break;
              }
              localObject12 = ((zb)localObject11).a(i2);
              d1 = Math.min(d1, ((a.d.w)localObject12).a);
              d2 = Math.min(d2, ((a.d.w)localObject12).b);
              d3 = Math.max(d3, ((a.d.w)localObject12).a);
              d5 = Math.max(d5, ((a.d.w)localObject12).b);
              i2++;
              if (bool2) {
                break label688;
              }
              if (bool1) {
                break label686;
              }
            } while (!bool1);
          } while (bool2);
          ((m)localObject10).f();
        } while (!bool1);
        localw4 = ((bb)localObject3).l();
        localw4.f();
        localObject10 = paramo.i();
        localHashSet.add(localObject10);
        Object localObject11 = paramo.d(localObject10);
        ((zc)localObject11).b(d3 - d1, d5 - d2);
        ((zc)localObject11).a(((Rectangle)localObject5).x, ((Rectangle)localObject5).y);
        d locald2 = paramo.a(((bb)localObject3).m(), (e)localObject10);
        ((y)localObject2).a((bb)localObject3);
        ((y)localObject2).b();
        localObject12 = new b_();
        ((b_)localObject12).b = locald2;
        ((b_)localObject12).a = ((e)localObject10);
        ((b_)localObject12).c = new Rectangle2D.Double(d1, d2, d3 - d1, d5 - d2);
        ((b_)localObject12).d = ((bb)localObject3);
        ((b_)localObject12).f = arrayOfab[j];
      } while (bool2);
      localArrayList.add(localObject12);
      j++;
    } while (!bool1);
    label879:
    ((y)localObject2).g();
    if (!bool2) {
      j = 0;
    }
    label901:
    if (j < localArrayList.size()) {}
    label913:
    while (bool2)
    {
      localObject3 = (b_)localArrayList.get(j);
      localObject4 = ((b_)localObject3).d.l();
      ((a.c.w)localObject4).f();
      if (((a.c.w)localObject4).e())
      {
        ((y)localObject2).a(((a.c.w)localObject4).d());
        ((a.c.w)localObject4).f();
      }
      for (;;)
      {
        if (!bool2) {
          if (!bool1)
          {
            if (!bool1) {
              break;
            }
            if (bool2) {
              continue;
            }
            j++;
          }
        }
      }
      if (!bool1) {
        break;
      }
    }
    a_ locala_ = new a_(localHashSet);
    a(paramo, locala_);
    ((y)localObject2).g();
    int k = 0;
    int m = 0;
    int n = 0;
    label1038:
    if (n < localArrayList.size()) {}
    Object localObject6;
    Object localObject7;
    Object localObject8;
    label1238:
    label1650:
    while (bool2)
    {
      int i1;
      double d4;
      double d6;
      double d7;
      int i3;
      int i4;
      Object localObject13;
      do
      {
        localObject5 = (b_)localArrayList.get(n);
        localObject6 = paramo.e(((b_)localObject5).b).c();
        localObject7 = paramo.e(((b_)localObject5).b);
        if (bool1) {
          break label2335;
        }
        a.d.w localw2;
        if (((zb)localObject7).a() > 0)
        {
          localObject8 = paramo.r(((b_)localObject5).b);
          localw2 = ((zb)localObject7).a(0);
          if (!bool2) {}
          i1 = Math.abs(((a.d.w)localObject8).a - localw2.a) > Math.abs(((a.d.w)localObject8).b - localw2.b) ? 1 : 0;
          if (!bool2) {
            if (!bool1) {
              break label1238;
            }
          }
        }
        else
        {
          localObject8 = paramo.r(((b_)localObject5).b);
          localw2 = paramo.s(((b_)localObject5).b);
        }
        if (!bool2) {}
        i1 = Math.abs(((a.d.w)localObject8).a - localw2.a) > Math.abs(((a.d.w)localObject8).b - localw2.b) ? 1 : 0;
        localObject8 = paramo.d(((b_)localObject5).a);
        d4 = ((b_)localObject5).c.getCenterX();
        d5 = ((b_)localObject5).c.getCenterY();
        d6 = ((zc)localObject8).a() + ((zc)localObject8).c() / 2.0D;
        d7 = ((zc)localObject8).b() + ((zc)localObject8).d() / 2.0D;
        localObject12 = ((b_)localObject5).d.l();
        zc localzc = paramo.d(((a.c.w)localObject12).d());
        if (!bool2) {}
        i3 = paramo.s(((b_)localObject5).b).a < paramo.r(((b_)localObject5).b).a ? 1 : 0;
        if (!bool2) {}
        i4 = paramo.s(((b_)localObject5).b).b < paramo.r(((b_)localObject5).b).b ? 1 : 0;
        paramo.a(((b_)localObject5).b);
        if (!bool2) {}
        k += (i3 != 0 ? -((b_)localObject5).d.size() : ((b_)localObject5).d.size());
        if (!bool2) {}
        m += (i4 != 0 ? -((b_)localObject5).d.size() : ((b_)localObject5).d.size());
        ((a.c.w)localObject12).f();
        do
        {
          if (!((a.c.w)localObject12).e()) {
            break label1697;
          }
          localObject13 = paramo.d(((a.c.w)localObject12).d());
          double d8 = ((zc)localObject13).a() + ((zc)localObject13).c() / 2.0D;
          double d9 = ((zc)localObject13).b() + ((zc)localObject13).d() / 2.0D;
          if (bool2) {
            break label1038;
          }
          if (bool1) {
            break;
          }
          if (i3 != 0)
          {
            d8 = d6 - (d8 - d4);
            if (bool2) {
              break label1612;
            }
            if (!bool1) {}
          }
          else
          {
            d8 = d6 + (d8 - d4);
          }
          if (!bool2)
          {
            if (i4 != 0) {
              d9 = d7 - (d9 - d5);
            }
          }
          else
          {
            if (bool2) {
              continue;
            }
            if (!bool1) {
              break label1650;
            }
          }
          d9 = d7 + (d9 - d5);
          ((zc)localObject13).a(d8 - ((zc)localObject13).c() / 2.0D, d9 - ((zc)localObject13).d() / 2.0D);
          ((a.c.w)localObject12).f();
        } while (!bool1);
        localObject13 = new ArrayList(6);
      } while (bool2);
      m localm = ((b_)localObject5).f.l();
      do
      {
        do
        {
          if (!localm.e()) {
            break label2304;
          }
          ((List)localObject13).clear();
          zb localzb = paramo.e(localm.a());
          ((List)localObject13).clear();
          if (bool1) {
            break;
          }
          int i5 = 0;
          a.d.w localw6;
          do
          {
            if (i5 >= localzb.a()) {
              break;
            }
            localw6 = localzb.a(i5);
            double d10 = localw6.a;
            double d11 = localw6.b;
            if (bool1) {
              break label1925;
            }
            if (i3 != 0)
            {
              d10 = d6 - (d10 - d4);
              if (bool2) {
                break label1847;
              }
              if (!bool1) {}
            }
            else
            {
              d10 = d6 + (d10 - d4);
            }
            if (!bool2)
            {
              if (i4 != 0) {
                d11 = d7 - (d11 - d5);
              }
            }
            else
            {
              if (bool2) {
                continue;
              }
              if (!bool1) {
                break label1885;
              }
            }
            d11 = d7 + (d11 - d5);
            ((List)localObject13).add(new a.d.w(d10, d11));
            i5++;
          } while (!bool1);
          localzb.b();
          if (!bool2) {
            i5 = 0;
          }
          if (i5 < ((List)localObject13).size()) {}
          while (bool2)
          {
            localw6 = (a.d.w)((List)localObject13).get(i5);
            if (bool2) {
              break label2233;
            }
            localzb.a(localw6.a, localw6.b);
            i5++;
            if (bool1) {
              break label2231;
            }
            if (!bool1) {
              break;
            }
          }
          a.d.w localw5;
          if (localm.a().e() == ((b_)localObject5).d.m())
          {
            localw5 = localzb.d();
            localzb.b(new a.d.w(i3 != 0 ? -localw5.a : localw5.a, i4 != 0 ? -localw5.b : localw5.b));
            localzb.a((a.d.w)localObject6);
            localw6 = paramo.r(localm.a());
            a.d.w localw7 = (bool2) || (localzb.a() > 0) ? localzb.a(0) : paramo.s(localm.a());
            z localz = paramo.m(localm.a());
            if (!bool2)
            {
              if (i1 != 0)
              {
                localz.a(new a.d.w(localw7.a, localw6.b));
                if (bool2) {
                  break label2228;
                }
              }
            }
            else {
              if (!bool1) {
                break label2215;
              }
            }
            localz.a(new a.d.w(localw6.a, localw7.b));
            paramo.b(localm.a(), localz);
          }
          else
          {
            localw5 = localzb.c();
            localzb.a(new a.d.w(i3 != 0 ? -localw5.a : localw5.a, i4 != 0 ? -localw5.b : localw5.b));
          }
          localm.f();
        } while (!bool1);
        paramo.a(((b_)localObject5).a);
        n++;
      } while (bool2);
      if (!bool1) {
        break;
      }
    }
    label1612:
    label1885:
    if (c()) {
      if ((bool2) || ((k < 0) || (m < 0)))
      {
        a.c.w localw1 = paramo.v();
        do
        {
          do
          {
            if (!localw1.e()) {
              break label2776;
            }
            localObject5 = localw1.d();
            localObject6 = paramo.d(localObject5);
            if ((!bool2) && (bool1)) {
              return;
            }
            if (!bool2) {
              if (k < 0) {
                ((zc)localObject6).a(-((zc)localObject6).a() - ((zc)localObject6).c(), ((zc)localObject6).b());
              }
            }
            if (m < 0) {
              ((zc)localObject6).a(((zc)localObject6).a(), -((zc)localObject6).b() - ((zc)localObject6).d());
            }
            localObject7 = ((e)localObject5).n();
            do
            {
              if (!((m)localObject7).e()) {
                break;
              }
              d locald1 = ((m)localObject7).a();
              localObject8 = paramo.e(locald1);
              Object localObject9 = ((zb)localObject8).c();
              if (bool2) {
                break label2773;
              }
              if (bool1) {
                break label2771;
              }
              ((zb)localObject8).a(new a.d.w(k < 0 ? -((a.d.w)localObject9).a : ((a.d.w)localObject9).a, m < 0 ? -((a.d.w)localObject9).b : ((a.d.w)localObject9).b));
              localObject9 = ((zb)localObject8).d();
              ((zb)localObject8).b(new a.d.w(k < 0 ? -((a.d.w)localObject9).a : ((a.d.w)localObject9).a, m < 0 ? -((a.d.w)localObject9).b : ((a.d.w)localObject9).b));
              localObject9 = paramo.m(locald1);
              v localv = ((z)localObject9).f();
              if (localv != null) {}
              do
              {
                a.d.w localw3 = (a.d.w)localv.c();
                if (bool1) {
                  break;
                }
                localv.a(new a.d.w(k < 0 ? -localw3.a : localw3.a, m < 0 ? -localw3.b : localw3.b));
                localv = localv.a();
                if (!bool1) {
                  break label2652;
                }
                paramo.b(locald1, (z)localObject9);
              } while (bool2);
              ((m)localObject7).f();
            } while (!bool1);
          } while (bool2);
          localw1.f();
        } while (!bool1);
      }
    }
    label1697:
    label1847:
    label2231:
    label2233:
    label2652:
    if (!bool2) {
      localArrayList.clear();
    }
    label1925:
    label2215:
    label2228:
    label2771:
    label2773:
    label2776:
    return;
  }
  
  protected void a(o paramo, a.c.k paramk)
  {
    rc localrc = a();
    paramo.a(e, paramk);
    localrc.doLayout(paramo);
    paramo.j(e);
  }
  
  public rc a()
  {
    return this.f;
  }
  
  public void a(rc paramrc)
  {
    this.f = paramrc;
  }
  
  public rc b()
  {
    return this.g;
  }
  
  public void b(rc paramrc)
  {
    this.g = paramrc;
  }
  
  public boolean c()
  {
    return this.h;
  }
  
  public void a(boolean paramBoolean)
  {
    this.h = paramBoolean;
  }
  
  static final class a_
    implements a.c.k
  {
    private Set a;
    
    a_(Set paramSet)
    {
      this.a = paramSet;
    }
    
    public Object get(Object paramObject)
    {
      throw new UnsupportedOperationException("Objects not supported!");
    }
    
    public boolean getBool(Object paramObject)
    {
      return this.a.contains(paramObject);
    }
    
    public double getDouble(Object paramObject)
    {
      throw new UnsupportedOperationException("doubles not supported!");
    }
    
    public int getInt(Object paramObject)
    {
      throw new UnsupportedOperationException("ints not supported!");
    }
  }
  
  static final class b_
  {
    public e a;
    public d b;
    public Rectangle2D c;
    public bb d;
    public ab f;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.n.jb

 * JD-Core Version:    0.7.0.1

 */